package com.chaopei.thread;

/**
 * @Author Corday 天涯
 * @Date 2022/3/14 14:55
 */
public class MyCalcThread extends Thread {
    private  int sum;
    private  int flag;
    @Override
    public void run() {
        for(int i=0;i<=50;i++){
            sum+=i;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        //用户判断中止线程
        flag=100;
    }
//    输出结果值
    public  int getSum(){
        return this.sum;
    }
    public int getFlag(){
        return this.flag;
    }
}
